package com.distribution.system.domain.converter;


import com.distribution.system.domain.dto.CmccDaAccountDetailQueryDto;
import com.distribution.system.domain.dto.CmccDaAccountDetailQueryReq;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import java.time.LocalDateTime;
import java.util.Objects;

@Mapper(componentModel = "spring", imports = {LocalDateTime.class, Objects.class})
public interface AccountDetailConverter {

    @Mapping(target = "beginTime", expression = "java(Objects.isNull(accountDetailQueryReq.getBeginTime()) ? null : LocalDateTime.parse(accountDetailQueryReq.getBeginTime()))")
    @Mapping(target = "endTime", expression = "java(Objects.isNull(accountDetailQueryReq.getEndTime()) ? null : LocalDateTime.parse(accountDetailQueryReq.getEndTime()))")
    CmccDaAccountDetailQueryDto accountDetailListExportReqToDto(CmccDaAccountDetailQueryReq accountDetailQueryReq);
}
